package shuishijie.suishijie.model;

import android.util.SparseArray;



import java.util.List;

import shuishijie.suishijie.util.AppUtil;

/**
 * Created by mindx on 2017/8/29.
 */

public class TransportDetail {

    /**
     * company : 顺丰
     * count : 0
     * msg : ok
     * result : {"deliverystatus":"3","issign":"1","list":[{"status":"在官网运单资料&签收图可查看签收人信息","time":"2017-09-22 00:52:57"},{"status":"已签收,感谢使用顺丰,期待再次为您服务","time":"2017-09-20 16:53:35"},{"status":"快件交给谭广艺，正在派送途中（联系电话：18241117513）","time":"2017-09-20 15:23:34"},{"status":"正在派送途中,请您准备签收(派件人:谭广艺,电话:18241117513)","time":"2017-09-20 15:22:30"},{"status":"快件到达 【大连市高新园区小平岛营业点】","time":"2017-09-20 15:11:44"},{"status":"快件在【大连甘井子集散中心】已装车，准备发往 【大连市高新园区小平岛营业点】","time":"2017-09-20 14:16:04"},{"status":"快件到达 【大连甘井子集散中心】","time":"2017-09-20 12:08:13"},{"status":"快件到达 【重庆总集散中心】","time":"2017-09-19 21:48:05"},{"status":"快件在【重庆总集散中心】已装车，准备发往 【杭州总集散中心】","time":"2017-09-19 21:48:05"},{"status":"快件在【重庆渝北集散中心】已装车，准备发往 【重庆总集散中心】","time":"2017-09-19 21:16:55"},{"status":"快件到达 【重庆渝北集散中心】","time":"2017-09-19 19:54:26"},{"status":"快件在【重庆江北尚品路营业点】已装车，准备发往 【重庆渝北集散中心】","time":"2017-09-19 18:51:50"},{"status":"顺丰速运 已收取快件","time":"2017-09-19 18:27:20"},{"status":"顺丰速运 已收取快件","time":"2017-09-19 18:18:21"}],"number":"824930447128","type":"sfexpress"}
     * status : 0
     */

    static SparseArray<String> delivery = new SparseArray<>(4);

    static {
        delivery.put(1, "在途中");
        delivery.put(2, "配件中");
        delivery.put(3, "已签收");
        delivery.put(4, "配件失败");
    }

    public String company;
    public int count;
    public String msg;
    public TransForResult result;
    public String status;

    public static class TransForResult {
        /**
         * deliverystatus : 3
         * issign : 1
         * list : [{"status":"在官网运单资料&签收图可查看签收人信息","time":"2017-09-22 00:52:57"},{"status":"已签收,感谢使用顺丰,期待再次为您服务","time":"2017-09-20 16:53:35"},{"status":"快件交给谭广艺，正在派送途中（联系电话：18241117513）","time":"2017-09-20 15:23:34"},{"status":"正在派送途中,请您准备签收(派件人:谭广艺,电话:18241117513)","time":"2017-09-20 15:22:30"},{"status":"快件到达 【大连市高新园区小平岛营业点】","time":"2017-09-20 15:11:44"},{"status":"快件在【大连甘井子集散中心】已装车，准备发往 【大连市高新园区小平岛营业点】","time":"2017-09-20 14:16:04"},{"status":"快件到达 【大连甘井子集散中心】","time":"2017-09-20 12:08:13"},{"status":"快件到达 【重庆总集散中心】","time":"2017-09-19 21:48:05"},{"status":"快件在【重庆总集散中心】已装车，准备发往 【杭州总集散中心】","time":"2017-09-19 21:48:05"},{"status":"快件在【重庆渝北集散中心】已装车，准备发往 【重庆总集散中心】","time":"2017-09-19 21:16:55"},{"status":"快件到达 【重庆渝北集散中心】","time":"2017-09-19 19:54:26"},{"status":"快件在【重庆江北尚品路营业点】已装车，准备发往 【重庆渝北集散中心】","time":"2017-09-19 18:51:50"},{"status":"顺丰速运 已收取快件","time":"2017-09-19 18:27:20"},{"status":"顺丰速运 已收取快件","time":"2017-09-19 18:18:21"}]
         * number : 824930447128
         * type : sfexpress
         */

        public String deliverystatus;

        public String getDeliverStatus() {
            int status = AppUtil.parseInt(deliverystatus);
            if (status > 0 && status < 5) {
                return delivery.get(status);
            }
            return "其他";
        }

        public String issign;
        public String number;
        public String type;
        public List<TransportProcess> list;

    }

    public static class TransportProcess {
        /**
         * status : 在官网运单资料&签收图可查看签收人信息
         * time : 2017-09-22 00:52:57
         */

        public String status;
        public String time;
    }
}
